Skip to content

[Backend] Automated Event Queue Scaffold for Payouts#309

Open
armorbreak001 wants to merge 1 commit intoGalactiGuild:mainfrom
armorbreak001:bounty/278-event-queue
Open

[Backend] Automated Event Queue Scaffold for Payouts#309
armorbreak001 wants to merge 1 commit intoGalactiGuild:mainfrom
armorbreak001:bounty/278-event-queue

Conversation

@armorbreak001
Copy link
Copy Markdown

Fixes #278

Changes

  • QUEUE_NAMES: Added BOUNTY_PAYOUTS = 'bounty-payouts'
  • PayoutJobData interface: { bountyId: string, approvedAddresses: string[] }
  • PayoutConsumer (src/queue/processors/payout.consumer.ts):
    • Listens to bounty-payouts queue
    • @Process('process-payout') — receives { bountyId, approvedAddresses }, simulates 2-second signature processing sleep
    • On success: updates Bounty status to COMPLETED
    • @OnQueueFailed() — updates local DB bounty status back to FAILED
    • @OnWorkerEvent hooks for active/completed logging
  • QueueModule: Registered BOUNTY_PAYOUTS queue + PayoutConsumer provider
  • QueueService: Added addPayoutJob(data) method

Acceptance Criteria Met

  • Inside src/queue/, established PayoutConsumer.ts
  • Listen to a bounty-payouts queue
  • When receiving a message { bountyId, approvedAddresses }, simulate a 2-second sleep
  • Add @Process() and explicit error-handling events for @OnQueueFailed() that update DB status back to FAILED

How to Verify

  1. Ensure Redis is running
  2. Start the server — PayoutConsumer auto-registers
  3. Call an endpoint that triggers queueService.addPayoutJob({ bountyId: 'test-1', approvedAddresses: ['0xabc...'] })
  4. Check logs: should show processing start, 2s simulation, completion

- Add BOUNTY_PAYOUTS queue name to QUEUE_NAMES
- Add PayoutJobData interface (bountyId, approvedAddresses[])
- Create PayoutConsumer processor in src/queue/processors/
  - @process('process-payout') with 2-second signature simulation
  - @OnQueueFailed() handler updates bounty status back to FAILED
  - Auto-updates bounty to COMPLETED after successful processing
- Register BOUNTY_PAYOUTS queue in QueueModule
- Add addPayoutJob() method to QueueService

Fixes GalactiGuild#278
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Backend] Automated Event Queue Scaffold for Payouts

1 participant